home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / stfight.c < prev    next >
Text File  |  2000-04-04  |  28KB  |  724 lines

  1. /*****************************          (by Mark McDougall)
  2.  *** STREET FIGHT hardware ***    This has been adapted from the excellent
  3.  *****************************  Psychic 5 description (by Roberto Ventura)
  4.  
  5. Street Fight (c) Seibu Kaihatsu (1986)
  6.  
  7.  
  8. 0) GENERAL.
  9.  
  10. The game has two Z80s.
  11. The second CPU controls the two YM2203 sound chips.
  12. There is an OKI M5205 ADPCM chip fed directly from a ROM.
  13. Screen resolution is 256x224 (horizontal CRT).
  14. 256 colors on screen.
  15. 128 sprites (16x16).
  16.  
  17.  
  18. 1) ROM CONTENTS.
  19.  
  20. SF01    Main program code (encrypted)
  21. SF02    Main program code bank-switched? into main cpu space
  22. SF03    Sound program code
  23. SF04    ADPCM voice data
  24. SF05-07 Foreground tile pixel data
  25. SF09    Foreground map data
  26. SF10    Foreground map/tile data
  27. SF11-14 Background tile pixel data
  28. SF15    Background map data
  29. SF16    Background map/tile data
  30. SF17    Character pixel data
  31. SF18-21 Sprite pixel data
  32.  
  33. All ROMS are 32K except SF17 which is 8K.
  34.  
  35. Graphics format is a little messy, the 4 planes come from a bit in
  36. the high and low nibble of each byte of a consecutive pair of roms.
  37.  
  38. All graphics are made of 16x16 (composite) tiles, each of which is composed
  39. of 4 consecutive 8x8 tiles. In all there are 1024 composite (16x16) tiles
  40. for each of the foreground, background and sprite layers. These can be
  41. considered as four banks each of 256 tiles.
  42.  
  43. Text characters are defined as 8x8 tiles.
  44.  
  45.  
  46. 2) CPU.
  47.  
  48. The board has a single? crystal @12.000 MHz.
  49. Both CPU clocks run at 3MHz (12/4).
  50.  
  51. The main Z80 runs in Interrupt mode 0 (IM0), the game program expects
  52. execution of two different restart (RST) instructions.
  53. RST 10,the main IRQ, is to be triggered each time the screen is refreshed.
  54. RST 08 must be triggered in order to make the game work properly. I haven't
  55. ascertained the exact frequency of this interrupt yet, though the game
  56. appears to run at the correct speed with RST08 at 30Hz. Curiously a trace
  57. on the interrupt pin shows two interrupts occuring at 60Hz, obviously the
  58. VBlank interrupt followed by a second interrupt some 3.3ms later. At some
  59. stage I'll get around to probing the data lines to find the interrupt
  60. vector addresses.
  61.  
  62. Sound CPU runs in IM1.
  63.  
  64. The sound CPU lies idle waiting the external IRQ occurrence executing code
  65. from $0100 to $010D.
  66.  
  67. Game code/data is directly accessible by the main CPU. There is what
  68. appears to be some level data in the second half of sf02 that may
  69. never be bank-switched in!?! Graphics data, ADPCM samples and level maps
  70. are not accessed by the CPUs.
  71.  
  72. Text video RAM is situated at $D000-$D7FF.
  73.  
  74.  
  75. 3) MAIN CPU MEMORY MAP.
  76.  
  77. $0000-$7FFF R   ROM sf01 (encrypted)
  78. $8000-$BFFF R   ROM sf02 (2 x 16k banks selected by D2 of ?)
  79. $C000-$C1FF W   Palette RAM
  80. $C200       R   player 1 controls hard value (negative logic)
  81.                 - MSB:x,x,B2,B1,RIGHT,LEFT,DOWN,UP
  82. $C201       R   player 2 controls hard value (negative logic)
  83.                 - MSB:x,x,B2,B1,RIGHT,LEFT,DOWN,UP
  84. $C202       R   start buttons (negative logic)
  85.                 - MSB:x,x,x,P2,P1,x,x,x:LSB
  86. $C203       R   dipswitch #1 hard value (negative logic)
  87.                 - 76543210
  88.                   xxxxx000  - coin A - 1 coin  / 1 credit
  89.                   xxxxx001           - 2 coins / 1 credit
  90.                   xxxxx010           - 1 coin  / 3 credits
  91.                   xxxxx011           - 4 coins / 1 credit
  92.                   xxxxx100           - 1 coin  / 2 credits
  93.                   xxxxx101           - 3 coins / 1 credit
  94.                   xxxxx110           - 1 coin  / 5 credits
  95.                   xxxxx111           - 5 coins / 1 credit
  96.                   xxx00xxx  - coin B - 1 coin  / 1 credit
  97.                   xxx01xxx           - 2 coins / 1 credit
  98.                   xxx10xxx           - 1 coin  / 2 credits
  99.                   xxx11xxx           - 2 coins / 3 credits
  100.                   xx1xxxxx  - test mode setting
  101.                   x1xxxxxx  - continue setting
  102.                   1xxxxxxx  - bullet colour setting
  103. $C204       R   dipswitch #2 hard value (negative logic)
  104.                 - 76543210
  105.                   xxxxxxx1  - cabinet style
  106.                   xxxxx11x  - difficulty
  107.                   xxx11xxx  - number of lives (-1)
  108.                   x00xxxxx  - 10,000 & 30,000
  109.                   x01xxxxx  - 20,000 & 40,000
  110.                   x10xxxxx  - 30,000 & 60,000
  111.                   x11xxxxx  - 40,000 & 80,000
  112.                   1xxxxxxx  - demo sound on/off
  113. $C205       R   read to determine coin circuit check status
  114. $C500       W   play fm number
  115. $C600       W   play voice number
  116. $C700       W   ?coin mechanism control?
  117. $C804       W   ?watchdog?
  118. $C806       W   ???
  119. $C807       W   current sprite bank h/w register
  120.                 - bank = b2,b0
  121. $D000-$D3FF W   VRAM (Character RAM)
  122. $D400-$D7FF W   VRAM (Attribute RAM)
  123.                 - b7    Character bank from SF17
  124.                 - b6    Flip Y
  125.                 - b5    Flip X
  126.                 - b4    ?
  127.                 - b3-0  ? Colour/Palette
  128. $D800-$D801 W   foreground layer x coordinate h/w register
  129. $D802-$D803 W   foreground layer y coordinate h/w register
  130. $D804-$D805 W   background layer x coordinate h/w register
  131. $D806,$D808 W   background layer y coordinate h/w register
  132. $D807       W   layer control h/w register
  133.                 - b7 = text layer
  134.                 - b6 = sprite layer
  135.                 - b5 = background layer
  136.                 - b4 = foreground layer
  137.                 - b0 = video orientation (1=upside-down)
  138. $E000-$FFFF RW  RAM SRM2064C (8k)
  139. $Fxx0-$Fxx3 W   Sprite Ram (every 32 ($20) bytes)
  140.                 - xx0 sprite number
  141.                 - xx1 sprite attribute
  142.                   - b7  sign extension of x coord
  143.                   - b4  flip x
  144.                 - xx2 y coord of sprite
  145.                 - xx3 x coord of sprite
  146.  
  147. 4) SOUND CPU MEMORY MAP.
  148.  
  149. $0000-$7FFF R   ROM (sf03)
  150. $C000       W   YM2203 #1 address register
  151. $C001       W   YM2203 #1 data register
  152. $C800       W   YM2203 #2 address register
  153. $C801       W   YM2203 #2 data register
  154. $E800       W   ??
  155. $F000       R   FM Voice number to play
  156.                 - b7    set for valid data latched
  157.                 - b6-b0 voice number
  158. $F800-$FFFF RW  RAM
  159.  
  160.  
  161. 5) COLOR RAM
  162.  
  163. The palette system is dynamic, the game can show up to 256 different
  164. colors on screen.
  165.  
  166. Each color component (RGB) depth is 4 bits, two bytes $100 apart are used
  167. for each color code (12 bits).
  168.  
  169. format: unknown - probably RRRRGGGG - 0000BBBB
  170.  
  171. I suspect that the colors are organized in sub-palettes, since the graphics
  172. layers are all 4 bits (16 colors) each. Each of the text/graphics layers
  173. have 'attribute' bytes associated with them that would define the palette
  174. usage for each character/tile.
  175.  
  176. The 16 colours at offset $C0 appear to be the text palette. This group of
  177. colours does not appear to change throughout the game, and the lower 192
  178. colours fade in/out independantly of these 16 - consistent with observations
  179. of the real game. You'd think then that the palette would be reaonably
  180. easy to deduce from the text video ram attribute byte - go ahead and try! :P
  181.  
  182. The mapping of graphics pixels to palette similarly escapes me, though I
  183. must admit I haven't exhausted all avenues of investigation just yet!
  184.  
  185. There is a related mystery with the transparency colour. For the most part
  186. colour 15 corresponds to the transparent colour, except in a few cases.
  187.  
  188. 6) TILE-BASED LAYERS
  189.  
  190. The foreground and background layers comprise static virtual layers which
  191. are 8 screens wide and 16 screens deep. The hardware scrolls around the
  192. layers by reading registers which are updated by sofware every VBlank.
  193. The text layer is fixed and cannot scroll.
  194.  
  195. The maps that define the foreground and background layers are stored in
  196. ROMs accessed directly by the hardware. They consist of 256 bytes for
  197. each screen which define the tile number, and a corresponding byte in
  198. a matching ROM which defines the tile bank and presumably palette info.
  199.  
  200. The top and bottom rows of the screen are not visible - resulting in a
  201. 256x224 viewport rather than 256 square. The layers can be individually
  202. enabled/disabled. Inactive sprites are 'parked' at row 0.
  203.  
  204. The rom layout for the foreground and sprite tiles are as you would expect,
  205. with the four 8x8 tiles that make a single composite tile consecutive in
  206. address. The background tiles are interleaved for presumably some good
  207. reason, the first two 8x8 tiles from composite tile n are followed by two
  208. 8x8 tiles from the (n+512)'th composite tile.
  209.  
  210. The map roms are similarly interleaved for the background layer only.
  211.  
  212. 7) SPRITES
  213.  
  214. The sprites are mapped into RAM locations $F000-$FFFF using only the first
  215. 4 bytes from each 32-byte slice. Intervening addresses appear to be
  216. conventional RAM. See the memory map for sprite data format.
  217.  
  218.  ****************************************************************************
  219.  
  220. TODO:
  221. - palette is incorporated - fix!!!
  222. - handle transparency in text layer properly (how?)
  223. - second bank of sf02 is this used? (probably NOT)
  224.  
  225. DONE? (check on real board)
  226. - sound (fm)
  227. - sound (adpcm)
  228.  
  229. *****************************************************************************/
  230.  
  231. #include "driver.h"
  232. #include "vidhrdw/generic.h"
  233.  
  234. // machine
  235. void init_empcity(void);
  236. void init_stfight(void);
  237. void stfight_init_machine(void);
  238. int  stfight_vb_interrupt( void );
  239. int  stfight_interrupt_1( void );
  240. int  stfight_interrupt_2( void );
  241. READ_HANDLER( stfight_dsw_r );
  242. WRITE_HANDLER( stfight_fm_w );
  243. WRITE_HANDLER( stfight_voice_w );
  244. READ_HANDLER( stfight_coin_r );
  245. WRITE_HANDLER( stfight_coin_w );
  246. WRITE_HANDLER( stfight_e800_w );
  247. READ_HANDLER( stfight_fm_r );
  248. void stfight_adpcm_int( int data );
  249. WRITE_HANDLER( stfight_adpcm_control_w );
  250.  
  251. // vidhrdw
  252. void stfight_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  253. WRITE_HANDLER( stfight_text_char_w );
  254. WRITE_HANDLER( stfight_text_attr_w );
  255. WRITE_HANDLER( stfight_vh_latch_w );
  256. WRITE_HANDLER( stfight_sprite_bank_w );
  257. int  stfight_vh_start( void );
  258. void stfight_vh_screenrefresh( struct osd_bitmap *bitmap, int full_refresh );
  259.  
  260. // vidhrdw
  261. extern unsigned char *stfight_text_char_ram;
  262. extern unsigned char *stfight_text_attr_ram;
  263. extern unsigned char *stfight_vh_latch_ram;
  264. extern unsigned char *stfight_sprite_ram;
  265.  
  266. static struct MemoryReadAddress readmem_cpu1[] =
  267. {
  268.     { 0x0000, 0x7fff, MRA_ROM },
  269.     { 0x8000, 0xbfff, MRA_BANK1 },          /* sf02.bin */
  270.     { 0xc000, 0xc1ff, MRA_RAM },            /* palette ram */
  271.     { 0xc200, 0xc200, input_port_0_r },     /* IN1 */
  272.     { 0xc201, 0xc201, input_port_1_r },     /* IN2 */
  273.     { 0xc202, 0xc202, input_port_2_r },     /* IN3 */
  274.     { 0xc203, 0xc204, stfight_dsw_r },      /* DS0,1 */
  275.     { 0xc205, 0xc205, stfight_coin_r },     /* coin mech */
  276.     { 0xd000, 0xd7ff, MRA_RAM },            /* video */
  277.     { 0xe000, 0xffff, MRA_RAM },
  278.  
  279.     { -1 }    /* end of table */
  280. };
  281.  
  282. static struct MemoryWriteAddress writemem_cpu1[] =
  283. {
  284.     { 0x0000, 0x7fff, MWA_ROM },
  285.     { 0x8000, 0xbfff, MWA_BANK1 },                  /* sf02.bin */
  286.     { 0xc000, 0xc0ff, paletteram_xxxxBBBBRRRRGGGG_split1_w, &paletteram },
  287.     { 0xc100, 0xc1ff, paletteram_xxxxBBBBRRRRGGGG_split2_w, &paletteram_2 },
  288.     { 0xc500, 0xc500, stfight_fm_w },               /* play fm sound */
  289.     { 0xc600, 0xc600, stfight_adpcm_control_w },    /* voice control */
  290.     { 0xc700, 0xc700, stfight_coin_w },             /* coin mech */
  291.     { 0xc804, 0xc806, MWA_NOP },                    /* TBD */
  292.     { 0xc807, 0xc807, stfight_sprite_bank_w },
  293.     { 0xd000, 0xd3ff, stfight_text_char_w,      &stfight_text_char_ram },
  294.     { 0xd400, 0xd7ff, stfight_text_attr_w,      &stfight_text_attr_ram },
  295.     { 0xd800, 0xd808, stfight_vh_latch_w,       &stfight_vh_latch_ram },
  296.     { 0xe000, 0xefff, MWA_RAM },
  297.     { 0xf000, 0xffff, MWA_RAM,                  &stfight_sprite_ram },
  298.  
  299.     { -1 }    /* end of table */
  300. };
  301.  
  302. static struct MemoryReadAddress readmem_cpu2[] =
  303. {
  304.     { 0x0000, 0x7fff, MRA_ROM },
  305.     { 0xc001, 0xc001, YM2203_read_port_0_r },
  306.     { 0xc801, 0xc801, YM2203_read_port_1_r },
  307.     { 0xf000, 0xf000, stfight_fm_r },
  308.     { 0xf800, 0xffff, MRA_RAM },
  309.  
  310.     { -1 }    /* end of table */
  311. };
  312.  
  313. static struct MemoryWriteAddress writemem_cpu2[] =
  314. {
  315.     { 0x0000, 0x7fff, MWA_ROM },
  316.     { 0xc000, 0xc000, YM2203_control_port_0_w },
  317.     { 0xc001, 0xc001, YM2203_write_port_0_w },
  318.     { 0xc800, 0xc800, YM2203_control_port_1_w },
  319.     { 0xc801, 0xc801, YM2203_write_port_1_w },
  320.     { 0xe800, 0xe800, stfight_e800_w },
  321.     { 0xf800, 0xffff, MWA_RAM },
  322.  
  323.     { -1 }    /* end of table */
  324. };
  325.  
  326.  
  327. INPUT_PORTS_START( stfight )
  328.     PORT_START    /* PLAYER 1 */
  329.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  330.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  331.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  332.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  333.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  334.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  335.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  336.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  337.  
  338.     PORT_START    /* PLAYER 2 */
  339.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  340.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  341.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  342.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  343.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  344.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  345.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  346.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  347.  
  348.     PORT_START    /* START BUTTONS */
  349.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  350.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  351.     PORT_BIT( 0xe7, IP_ACTIVE_LOW, IPT_UNUSED )
  352.  
  353.     PORT_START    /* DSW0 */
  354.  
  355.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  356.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  357.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
  358.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  359.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  360.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  361.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  362.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  363.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
  364.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
  365.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  366.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  367.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_3C ) )
  368.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  369.     PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )
  370.     PORT_DIPNAME( 0x40, 0x40, "Allow Continue" )
  371.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  372.     PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
  373.     PORT_DIPNAME( 0x80, 0x80, "Bullet Colour" )
  374.     PORT_DIPSETTING(    0x80, "Red" )
  375.     PORT_DIPSETTING(    0x00, "Blue" )
  376.  
  377.     PORT_START    /* DSW1 */
  378.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  379.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  380.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  381.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Difficulty ) )
  382.     PORT_DIPSETTING(    0x00, "Easy" )
  383.     PORT_DIPSETTING(    0x02, "Normal" )
  384.     PORT_DIPSETTING(    0x04, "Hard" )
  385.     PORT_DIPSETTING(    0x06, "Hardest" )
  386.     PORT_DIPNAME( 0x18, 0x10, DEF_STR( Lives ) )
  387.     PORT_DIPSETTING(    0x00, "1" )
  388.     PORT_DIPSETTING(    0x08, "2" )
  389.     PORT_DIPSETTING(    0x10, "3" )
  390.     PORT_DIPSETTING(    0x18, "4" )
  391.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Bonus_Life ) )
  392.     PORT_DIPSETTING(    0x00, "10000 30000" )
  393.     PORT_DIPSETTING(    0x20, "20000 40000" )
  394.     PORT_DIPSETTING(    0x40, "30000 60000" )
  395.     PORT_DIPSETTING(    0x60, "40000 80000" )
  396.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
  397.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  398.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  399.  
  400.     PORT_START    /* COIN MECH */
  401.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_LOW, IPT_COIN1, 2 )
  402.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_LOW, IPT_COIN2, 2 )
  403. INPUT_PORTS_END
  404.  
  405.  
  406. /* text-layer characters */
  407. static struct GfxLayout charlayout =
  408. {
  409.     8,8,        /* 8*8 pixels */
  410.     512,        /* 512 characters */
  411.     2,            /* 2 bits per pixel */
  412.     { 4, 0 },
  413.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
  414.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  415.     8*16        /* every char takes 16 consecutive bytes */
  416. };
  417.  
  418. /* foreground tiles */
  419. static struct GfxLayout fglayout =
  420. {
  421.     16,16,        /* 16*16 pixels */
  422.     1024,        /* 1024 tiles */
  423.     4,            /* 4 bits per pixel */
  424.     { 64*1024*8+0, 64*1024*8+4, 0, 4 },
  425.     {      0,      1,       2,       3,
  426.            8,      9,      10,      11,
  427.       32*8+0, 32*8+1, 32*8+ 2, 32*8+ 3,
  428.       32*8+8, 32*8+9, 32*8+10, 32*8+11 },
  429.     {  0*8,  2*8,  4*8,  6*8,
  430.        8*8, 10*8, 12*8, 14*8,
  431.       16*8, 18*8, 20*8, 22*8,
  432.       24*8, 26*8, 28*8, 30*8 },
  433.     64*8        /* every char takes 64 consecutive bytes */
  434. };
  435.  
  436. /*
  437.  *      The background tiles are interleaved in banks of 2
  438.  *      - so we need to create two separate layout structs
  439.  *        to handle them properly with tilemaps
  440.  */
  441.  
  442. /* background tiles */
  443. static struct GfxLayout bglayout =
  444. {
  445.     16,16,        /* 16*16 pixels */
  446.     512,        /* 512 tiles */
  447.     4,            /* 4 bits per pixel */
  448.     { 64*1024*8+4, 64*1024*8+0, 4, 0 },
  449.     {      0,      1,       2,       3,
  450.            8,      9,      10,      11,
  451.       64*8+0, 64*8+1, 64*8+ 2, 64*8+ 3,
  452.       64*8+8, 64*8+9, 64*8+10, 64*8+11 },
  453.     {  0*8,  2*8,  4*8,  6*8,
  454.        8*8, 10*8, 12*8, 14*8,
  455.       16*8, 18*8, 20*8, 22*8,
  456.       24*8, 26*8, 28*8, 30*8 },
  457.     128*8        /* every tile takes 64/128 consecutive bytes */
  458. };
  459.  
  460. /* sprites */
  461. static struct GfxLayout spritelayout =
  462. {
  463.     16,16,        /* 16*16 pixels */
  464.     1024,        /* 1024 sprites */
  465.     4,            /* 4 bits per pixel */
  466.     { 64*1024*8+0, 64*1024*8+4, 0, 4 },
  467.     {      0,      1,       2,       3,
  468.            8,      9,      10,      11,
  469.       32*8+0, 32*8+1, 32*8+ 2, 32*8+ 3,
  470.       32*8+8, 32*8+9, 32*8+10, 32*8+11 },
  471.     {  0*8,  2*8,  4*8,  6*8,
  472.        8*8, 10*8, 12*8, 14*8,
  473.       16*8, 18*8, 20*8, 22*8,
  474.       24*8, 26*8, 28*8, 30*8 },
  475.     64*8        /* every sprite takes 64 consecutive bytes */
  476. };
  477.  
  478.  
  479. static struct GfxDecodeInfo gfxdecodeinfo[] =
  480. {
  481.     { REGION_GFX1, 0x0000, &charlayout,   0,                16 },
  482.     { REGION_GFX2, 0x0000, &fglayout,     16*4,             16 },
  483.     { REGION_GFX3, 0x0000, &bglayout,     16*4+16*16,       16 },
  484.     { REGION_GFX3, 0x0020, &bglayout,     16*4+16*16,       16 },
  485.     { REGION_GFX4, 0x0000, &spritelayout, 16*4+16*16+16*16, 16 },
  486.     { -1 } /* end of array */
  487. };
  488.  
  489. static struct YM2203interface ym2203_interface =
  490. {
  491.     2,            /* 2 chips */
  492.     1500000,    /* 1.5 MHz */
  493.     { YM2203_VOL(10,15), YM2203_VOL(10,15) },
  494.     { 0 },
  495.     { 0 },
  496.     { 0 },
  497.     { 0 }
  498. };
  499.  
  500. static struct MSM5205interface msm5205_interface =
  501. {
  502.     1,                    /* 1 chip            */
  503.     384000,                /* 384KHz             */
  504.     { stfight_adpcm_int },  /* interrupt function */
  505.     { MSM5205_S48_4B },    /* 8KHz               */
  506.     { 50 }
  507. };
  508.  
  509. static struct MachineDriver machine_driver_stfight =
  510. {
  511.     /* basic machine hardware */
  512.     {
  513.         {
  514.             CPU_Z80,
  515.             3000000,    /* 3 Mhz */
  516.             readmem_cpu1, writemem_cpu1, 0, 0,
  517.             stfight_vb_interrupt, 1,
  518.             stfight_interrupt_1, 30
  519.         },
  520.         {
  521.             CPU_Z80 | CPU_AUDIO_CPU,
  522.             3000000,    /* 3 Mhz */
  523.             readmem_cpu2, writemem_cpu2, 0, 0,
  524.             0, 0,
  525.             stfight_interrupt_2, 120
  526.         }
  527.     },
  528.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  529.     10,
  530.     stfight_init_machine,
  531.  
  532.     /* video hardware */
  533.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  534.     gfxdecodeinfo,
  535.     256+1, 16*4+16*16+16*16+16*16,
  536.     stfight_vh_convert_color_prom,
  537.  
  538.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  539.     0,
  540.  
  541.     stfight_vh_start,
  542.     0,
  543.     stfight_vh_screenrefresh,
  544.  
  545.     /* sound hardware */
  546.     0,0,0,0,
  547.     {
  548.         {
  549.             SOUND_YM2203,
  550.             &ym2203_interface
  551.         },
  552.         {
  553.             SOUND_MSM5205,
  554.             &msm5205_interface
  555.         }
  556.     }
  557. };
  558.  
  559.  
  560. /***************************************************************************
  561.  
  562.   Game driver(s)
  563.  
  564. ***************************************************************************/
  565.  
  566. ROM_START( empcity )
  567.     ROM_REGION( 2*0x18000, REGION_CPU1 )    /* 96k for code + 96k for decrypted opcodes */
  568.     ROM_LOAD( "ec_01.rom",  0x00000, 0x8000, 0xfe01d9b1 )
  569.     ROM_LOAD( "ec_02.rom",  0x10000, 0x8000, 0xb3cf1ef7 )    /* bank switched */
  570.  
  571.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  572.     ROM_LOAD( "ec_04.rom",  0x0000,  0x8000, 0xaa3e7d1e )
  573.  
  574.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )    /* character data */
  575.     ROM_LOAD( "sf17.bin",   0x0000, 0x2000, 0x1b3706b5 )
  576.  
  577.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE ) /* foreground tile pixel data */
  578.     ROM_LOAD( "sf07.bin",   0x10000, 0x8000, 0x2c6caa5f )
  579.     ROM_LOAD( "sf08.bin",   0x18000, 0x8000, 0xe11ded31 )
  580.     ROM_LOAD( "sf05.bin",   0x00000, 0x8000, 0x0c099a31 )
  581.     ROM_LOAD( "sf06.bin",   0x08000, 0x8000, 0x3cc77c31 )
  582.  
  583.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* background tile pixel data */
  584.     ROM_LOAD( "sf13.bin",   0x10000, 0x8000, 0x0ae48dd3 )
  585.     ROM_LOAD( "sf14.bin",   0x18000, 0x8000, 0xdebf5d76 )
  586.     ROM_LOAD( "sf11.bin",   0x00000, 0x8000, 0x8261ecfe )
  587.     ROM_LOAD( "sf12.bin",   0x08000, 0x8000, 0x71137301 )
  588.  
  589.     ROM_REGION( 0x20000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* sprite data */
  590.     ROM_LOAD( "sf20.bin",   0x10000, 0x8000, 0x8299f247 )
  591.     ROM_LOAD( "sf21.bin",   0x18000, 0x8000, 0xb57dc037 )
  592.     ROM_LOAD( "sf18.bin",   0x00000, 0x8000, 0x68acd627 )
  593.     ROM_LOAD( "sf19.bin",   0x08000, 0x8000, 0x5170a057 )
  594.  
  595.     ROM_REGION( 0x10000, REGION_GFX5 )    /* foreground map data */
  596.     ROM_LOAD( "sf09.bin",   0x00000, 0x8000, 0x8ceaf4fe )
  597.     ROM_LOAD( "sf10.bin",   0x08000, 0x8000, 0x5a1a227a )
  598.  
  599.     ROM_REGION( 0x10000, REGION_GFX6 )    /* background map data */
  600.     ROM_LOAD( "sf15.bin",   0x00000, 0x8000, 0x27a310bc )
  601.     ROM_LOAD( "sf16.bin",   0x08000, 0x8000, 0x3d19ce18 )
  602.  
  603.     ROM_REGION( 0x0800, REGION_PROMS )
  604.     ROM_LOAD( "82s129.006", 0x0000, 0x0100, 0xf9424b5b )    /* text lookup table */
  605.     ROM_LOAD( "82s129.002", 0x0100, 0x0100, 0xc883d49b )    /* fg lookup table */
  606.     ROM_LOAD( "82s129.003", 0x0200, 0x0100, 0xaf81882a )
  607.     ROM_LOAD( "82s129.004", 0x0300, 0x0100, 0x1831ce7c )    /* bg lookup table */
  608.     ROM_LOAD( "82s129.005", 0x0400, 0x0100, 0x96cb6293 )
  609.     ROM_LOAD( "82s129.052", 0x0500, 0x0100, 0x3d915ffc )    /* sprite lookup table */
  610.     ROM_LOAD( "82s129.066", 0x0600, 0x0100, 0x51e8832f )
  611.     ROM_LOAD( "82s129.015", 0x0700, 0x0100, 0x0eaf5158 )    /* timing? (not used) */
  612.  
  613.     ROM_REGION( 0x08000, REGION_SOUND1 )    /* adpcm voice data */
  614.     ROM_LOAD( "sf04.bin",   0x00000, 0x8000, 0x1b8d0c07 )
  615. ROM_END
  616.  
  617. ROM_START( empcityj )
  618.     ROM_REGION( 2*0x18000, REGION_CPU1 )    /* 96k for code + 96k for decrypted opcodes */
  619.     ROM_LOAD( "1.bin",      0x00000, 0x8000, 0x8162331c )
  620.     ROM_LOAD( "2.bin",      0x10000, 0x8000, 0x960edea6 )    /* bank switched */
  621.  
  622.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  623.     ROM_LOAD( "ec_04.rom",  0x0000,  0x8000, 0xaa3e7d1e )
  624.  
  625.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )    /* character data */
  626.     ROM_LOAD( "sf17.bin",   0x0000, 0x2000, 0x1b3706b5 )
  627.  
  628.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE ) /* foreground tile pixel data */
  629.     ROM_LOAD( "sf07.bin",   0x10000, 0x8000, 0x2c6caa5f )
  630.     ROM_LOAD( "sf08.bin",   0x18000, 0x8000, 0xe11ded31 )
  631.     ROM_LOAD( "sf05.bin",   0x00000, 0x8000, 0x0c099a31 )
  632.     ROM_LOAD( "sf06.bin",   0x08000, 0x8000, 0x3cc77c31 )
  633.  
  634.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* background tile pixel data */
  635.     ROM_LOAD( "sf13.bin",   0x10000, 0x8000, 0x0ae48dd3 )
  636.     ROM_LOAD( "sf14.bin",   0x18000, 0x8000, 0xdebf5d76 )
  637.     ROM_LOAD( "sf11.bin",   0x00000, 0x8000, 0x8261ecfe )
  638.     ROM_LOAD( "sf12.bin",   0x08000, 0x8000, 0x71137301 )
  639.  
  640.     ROM_REGION( 0x20000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* sprite data */
  641.     ROM_LOAD( "sf20.bin",   0x10000, 0x8000, 0x8299f247 )
  642.     ROM_LOAD( "sf21.bin",   0x18000, 0x8000, 0xb57dc037 )
  643.     ROM_LOAD( "sf18.bin",   0x00000, 0x8000, 0x68acd627 )
  644.     ROM_LOAD( "sf19.bin",   0x08000, 0x8000, 0x5170a057 )
  645.  
  646.     ROM_REGION( 0x10000, REGION_GFX5 )    /* foreground map data */
  647.     ROM_LOAD( "sf09.bin",   0x00000, 0x8000, 0x8ceaf4fe )
  648.     ROM_LOAD( "sf10.bin",   0x08000, 0x8000, 0x5a1a227a )
  649.  
  650.     ROM_REGION( 0x10000, REGION_GFX6 )    /* background map data */
  651.     ROM_LOAD( "sf15.bin",   0x00000, 0x8000, 0x27a310bc )
  652.     ROM_LOAD( "sf16.bin",   0x08000, 0x8000, 0x3d19ce18 )
  653.  
  654.     ROM_REGION( 0x0800, REGION_PROMS )
  655.     ROM_LOAD( "82s129.006", 0x0000, 0x0100, 0xf9424b5b )    /* text lookup table */
  656.     ROM_LOAD( "82s129.002", 0x0100, 0x0100, 0xc883d49b )    /* fg lookup table */
  657.     ROM_LOAD( "82s129.003", 0x0200, 0x0100, 0xaf81882a )
  658.     ROM_LOAD( "82s129.004", 0x0300, 0x0100, 0x1831ce7c )    /* bg lookup table */
  659.     ROM_LOAD( "82s129.005", 0x0400, 0x0100, 0x96cb6293 )
  660.     ROM_LOAD( "82s129.052", 0x0500, 0x0100, 0x3d915ffc )    /* sprite lookup table */
  661.     ROM_LOAD( "82s129.066", 0x0600, 0x0100, 0x51e8832f )
  662.     ROM_LOAD( "82s129.015", 0x0700, 0x0100, 0x0eaf5158 )    /* timing? (not used) */
  663.  
  664.     ROM_REGION( 0x08000, REGION_SOUND1 )    /* adpcm voice data */
  665.     ROM_LOAD( "sf04.bin",   0x00000, 0x8000, 0x1b8d0c07 )
  666. ROM_END
  667.  
  668. ROM_START( stfight )
  669.     ROM_REGION( 2*0x18000, REGION_CPU1 )    /* 96k for code + 96k for decrypted opcodes */
  670.     ROM_LOAD( "a-1.4q",     0x00000, 0x8000, 0xff83f316 )
  671.     ROM_LOAD( "sf02.bin",   0x10000, 0x8000, 0xe626ce9e )    /* bank switched */
  672.  
  673.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the second CPU */
  674.     ROM_LOAD( "sf03.bin",   0x0000,  0x8000, 0x6a8cb7a6 )
  675.  
  676.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )    /* character data */
  677.     ROM_LOAD( "sf17.bin",   0x0000, 0x2000, 0x1b3706b5 )
  678.  
  679.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE ) /* foreground tile pixel data */
  680.     ROM_LOAD( "sf07.bin",   0x10000, 0x8000, 0x2c6caa5f )
  681.     ROM_LOAD( "sf08.bin",   0x18000, 0x8000, 0xe11ded31 )
  682.     ROM_LOAD( "sf05.bin",   0x00000, 0x8000, 0x0c099a31 )
  683.     ROM_LOAD( "sf06.bin",   0x08000, 0x8000, 0x3cc77c31 )
  684.  
  685.     ROM_REGION( 0x20000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* background tile pixel data */
  686.     ROM_LOAD( "sf13.bin",   0x10000, 0x8000, 0x0ae48dd3 )
  687.     ROM_LOAD( "sf14.bin",   0x18000, 0x8000, 0xdebf5d76 )
  688.     ROM_LOAD( "sf11.bin",   0x00000, 0x8000, 0x8261ecfe )
  689.     ROM_LOAD( "sf12.bin",   0x08000, 0x8000, 0x71137301 )
  690.  
  691.     ROM_REGION( 0x20000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* sprite data */
  692.     ROM_LOAD( "sf20.bin",   0x10000, 0x8000, 0x8299f247 )
  693.     ROM_LOAD( "sf21.bin",   0x18000, 0x8000, 0xb57dc037 )
  694.     ROM_LOAD( "sf18.bin",   0x00000, 0x8000, 0x68acd627 )
  695.     ROM_LOAD( "sf19.bin",   0x08000, 0x8000, 0x5170a057 )
  696.  
  697.     ROM_REGION( 0x10000, REGION_GFX5 )    /* foreground map data */
  698.     ROM_LOAD( "sf09.bin",   0x00000, 0x8000, 0x8ceaf4fe )
  699.     ROM_LOAD( "sf10.bin",   0x08000, 0x8000, 0x5a1a227a )
  700.  
  701.     ROM_REGION( 0x10000, REGION_GFX6 )    /* background map data */
  702.     ROM_LOAD( "sf15.bin",   0x00000, 0x8000, 0x27a310bc )
  703.     ROM_LOAD( "sf16.bin",   0x08000, 0x8000, 0x3d19ce18 )
  704.  
  705.     ROM_REGION( 0x0800, REGION_PROMS )
  706.     ROM_LOAD( "82s129.006", 0x0000, 0x0100, 0xf9424b5b )    /* text lookup table */
  707.     ROM_LOAD( "82s129.002", 0x0100, 0x0100, 0xc883d49b )    /* fg lookup table */
  708.     ROM_LOAD( "82s129.003", 0x0200, 0x0100, 0xaf81882a )
  709.     ROM_LOAD( "82s129.004", 0x0300, 0x0100, 0x1831ce7c )    /* bg lookup table */
  710.     ROM_LOAD( "82s129.005", 0x0400, 0x0100, 0x96cb6293 )
  711.     ROM_LOAD( "82s129.052", 0x0500, 0x0100, 0x3d915ffc )    /* sprite lookup table */
  712.     ROM_LOAD( "82s129.066", 0x0600, 0x0100, 0x51e8832f )
  713.     ROM_LOAD( "82s129.015", 0x0700, 0x0100, 0x0eaf5158 )    /* timing? (not used) */
  714.  
  715.     ROM_REGION( 0x08000, REGION_SOUND1 )    /* adpcm voice data */
  716.     ROM_LOAD( "sf04.bin",   0x00000, 0x8000, 0x1b8d0c07 )
  717. ROM_END
  718.  
  719.  
  720.  
  721. GAME( 1986, empcity,  0,       stfight, stfight, empcity, ROT0, "Seibu Kaihatsu", "Empire City: 1931 (bootleg?)" )
  722. GAME( 1986, empcityj, empcity, stfight, stfight, stfight, ROT0, "[Seibu Kaihatsu] (Taito license)", "Empire City: 1931 (Japan)" )
  723. GAME( 1986, stfight,  empcity, stfight, stfight, stfight, ROT0, "Seibu Kaihatsu", "Street Fight (Germany)" )
  724.